<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>淼森商城--登录页面</title>
    <link rel="stylesheet" href="css/reset.css"/>
    <link rel="stylesheet" href="css/common.css"/>
    <link rel="stylesheet" type="text/css" href="css/webbase.css"/>
    <link rel="stylesheet" type="text/css" href="css/pages-login.css"/>
</head>
<body>
<div class="wrap login_wrap" id="loginApp">
    <div class="content" style="margin-top:8%">
        <div class="my-logo"></div>
        <div class="login_box">
            <div class="login_form">
                <div class="login_title">
                    登录
                </div>
                <form class="sui-form">
                    <div class="input-prepend"><span class="add-on loginname"></span>
                        <input id="username" type="text" placeholder="用户名/手机号" class="span2 input-xfat"
                               v-model="form.username">
                    </div>
                    <div class="input-prepend"><span class="add-on loginpwd"></span>
                        <input id="password" type="password" placeholder="请输入密码" class="span2 input-xfat"
                               v-model="form.password">
                    </div>
                    <div class="setting">
                        <label class="checkbox inline">
                            <input name="m1" type="checkbox" value="2" checked="">
                            自动登录
                        </label>
                        <span class="forget">忘记密码？</span>
                    </div>
                    <div class="logined">
                        <a class="sui-btn btn-block btn-xlarge btn-danger" @click="login" href="javascript:void(0)">登&nbsp;&nbsp;录</a>
                    </div>
                    <div class="form_reg_btn">
                        <span>还没有帐号？</span><a href="register.html">马上注册</a>
                    </div>
                </form>
                <div class=""></div>
            </div>
        </div>
    </div>

    <!--foot-->

    <script type="text/javascript" src="js/plugins/jquery/jquery.min.js"></script>
    <!-- 底部栏位 -->
    <!--页面底部版权信息，由js动态加载-->
    <div class="Mod-copyright"></div>
    <!--<script type="text/javascript">$(".Mod-copyright").load("copyright.html");</script>-->
    <!--页面底部END-->
</div>

<script type="text/javascript" src="js/plugins/jquery/jquery.min.js"></script>
<script type="text/javascript" src="js/plugins/jquery.easing/jquery.easing.min.js"></script>
<script type="text/javascript" src="js/plugins/sui/sui.min.js"></script>
<script type="text/javascript" src="js/plugins/jquery-placeholder/jquery.placeholder.min.js"></script>
<script type="text/javascript" src="js/pages/login.js"></script>
</body>
<script src="./js/vue/vue.js"></script>
<script src="./js/axios.min.js"></script>
<script src="./js/common.js"></script>
<script type="text/javascript">
    var loginVm = new Vue({
        el: "#loginApp",
        data: {
            form:{
                username:'',
                password:''
            },
            msg:''
        },
        methods:{
            login(){
                xxacker.http.post("/auth/accredit",xxacker.stringify(this.form))
                    .then(resp => {
                        if(resp.status === 200){
                            const url = xxacker.getUrlParam("returnUrl");
                            window.location = url || 'http://www.xaexcellent.com';
                        }
                    })
                    .catch(() => this.msg = '用户名或密码错误')
            }
        }
    });
</script>
</html>